//
//  HPEncode.h
//  Network
//
//  Created by phq on 2019/7/4.
//  Copyright © 2017年 phq. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface HPEncode : NSObject

@end

@interface NSString (Encryption)

// url UTF8
- (NSString *)utf8Encode;
- (NSString *)utf8Decode;
// base64
- (NSString *)base64Encode;
- (NSString *)base64Decode;

// MD5加密
- (NSString *)md5Encode;

// sha1
- (NSString *)sha1Encode;
// HMAC-SHA1 + base64
- (NSString *)hmacsha1EncodeWithKey:(NSString *)secret;

// unicode
- (NSString *)encodeUnicode;
@end

@interface NSData (Encryption)

// base64
- (NSString *)base64Encode;
- (NSData *)base64Encoded;
+ (NSData *)base64Decode:(NSString *)string;

// AES
- (NSData *)aes256_encrypt:(NSString *)key;
- (NSData *)aes256_decrypt:(NSString *)key;

// DES
- (NSData *)des_encrypt:(NSString *)key;
- (NSData *)des_decrypt:(NSString *)key;
@end
